package cn.shuangliang.contract.web;

import cn.shuangliang.contract.model.Product;
import cn.shuangliang.contract.service.ProductService;
import cn.shuangliang.contract.vo.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author oldliu
 * @since 1.0
 */
//@Controller
//@ResponseBody
@RestController
@RequestMapping("product")
public class ProductController {
    @Resource
    private ProductService productService;

    //!!!返回的不是视图，是对象
    @GetMapping("search")
    public Page<Product> search(@RequestParam(name = "page",defaultValue = "1") int pageNo, @RequestParam(name = "pname",required = false)String pname, @RequestParam(name = "type",required = false)String type){
        return productService.search(pageNo,pname,type);
    }
}
